package com.you.raft.common.entity;

import lombok.Data;

import java.io.Serializable;

@Data
public class ClientRequest implements Serializable {

    public static int PUT = 0;
    public static int GET = 1;
    public static int DEL = 2;

    int type;

    String key;

    String value;

    public enum Type {
        /**
         * 1111
         */
        PUT(0), GET(1), DEL(2);
        int code;

        Type(int code) {
            this.code = code;
        }

        public static Type value(int code) {
            for (Type type : values()) {
                if (type.code == code) {
                    return type;
                }
            }
            return null;
        }

        public int getCode() {
            return code;
        }

    }
}
